//读取persons.json文件
//加载fs模块
let fs = require("fs");

//console.log(__dirname);
//使用fs模块加载persons.json文件
//d:\Users\Desktop\1214\day5\作业评讲
let data = fs.readFileSync(__dirname + "/persons.json", "utf8");
//console.log(data);
data = JSON.parse(data);
//console.log(data);

//文本框输入的
let user = { username: "xiaoming1", password: "1111" }

let u = data.find((item, index) => {
    //console.log(item);
    return user.username == item.username && user.password == item.password
})

if (u) {
    console.log("登录成功")
}
else {
    console.log("登录失败")
}